import axios from "axios";

export function request(config) {
  const instanse = axios.create({
    baseURL: "http://localhost:3000/",
    timeout: 1000,
  });

  return instanse(config);
}

// 登录信息
export function getLogin(data) {
  return request({
    url: "/login",
    method: "post",
    data,
  });
}

// 获取用户信息
export function getInfo(data) {
  return request({
    url: "/getinfo",
    method: "post",
    data,
  });
}

// overview 数目总览
export function overview() {
  return request({
    url: "/overview",
  });
}

// 全部学生信息
export function selectallstudent(page) {
  return request({
    url: "/select/allstudent/" + page,
  });
}
// 全部学生课程信息
export function selectallCourseInfo(page) {
  return request({
    url: "/select/allcourse/" + page,
  });
}
// 全部毕业学生信息
export function selectallgraduate(page) {
  return request({
    url: "/select/allgraduate/" + page,
  });
}
// 学号id查找毕业学生信息
export function selectGraduateByStuid(stuid, page) {
  return request({
    url: "/selectGraduateByStuid/" + stuid + "/page/" + page,
  });
}
// 全部学生贷款信息
export function selectallLoanInfo(page) {
  return request({
    url: "/select/selectallLoanInfo/" + page,
  });
}

// 全部学生奖励信息
export function selectallRewardInfo(page) {
  return request({
    url: "/select/allReward/" + page,
  });
}
// 全部学生处分信息
export function selectallpunishmentInfo(page) {
  return request({
    url: "/select/punishment/" + page,
  });
}
// 学号id查找学生奖励信息
export function selectRewardByStuid(stuid, page) {
  return request({
    url: "/selectRewardByStuid/" + stuid + "/page/" + page,
  });
}

// 学号id查找学生处分信息 selectpunishmentByStuid
export function selectpunishmentByStuid(stuid, page) {
  return request({
    url: "/selectpunishmentByStuid/" + stuid + "/page/" + page,
  });
}
//新增学生奖励信息 addRewardInfo
export function addRewardInfo(data) {
  return request({
    url: "/addRewardInfo",
    method: "post",
    data,
  });
}

//新增学生处分信息 addpunishmentInfo
export function addpunishmentInfo(data) {
  return request({
    url: "/addpunishmentInfo",
    method: "post",
    data,
  });
}

//修改学生奖励信息 updateRewardInfo
export function updateRewardInfo(data) {
  return request({
    url: "/updateRewardInfo",
    method: "post",
    data,
  });
}
//修改学生处分信息 updatepunishmentInfo
export function updatepunishmentInfo(data) {
  return request({
    url: "/updatepunishmentInfo",
    method: "post",
    data,
  });
}
// 删除学生奖励信息 deleteReward
export function deleteReward(data) {
  return request({
    url: "/deleteReward",
    method: "post",
    data,
  });
}
// 删除学生处分信息 deletepunishment
export function deletepunishment(data) {
  return request({
    url: "/deletepunishment",
    method: "post",
    data,
  });
}
// 学号id查找课程信息
export function selectCourseByStuid(stuid, page) {
  return request({
    url: "/selectCourseByStuid/" + stuid + "/page/" + page,
  });
}
//新增学生课程信息addCourseInfo
export function addCourseInfo(data) {
  return request({
    url: "/addCourseInfo",
    method: "post",
    data,
  });
}
//修改学生课程信息updateCourseInfo
export function updateCourseInfo(data) {
  return request({
    url: "/updateCourseInfo",
    method: "post",
    data,
  });
}
// 删除课程学生信息
export function deleteCourse(data) {
  return request({
    url: "/deleteCourse",
    method: "post",
    data,
  });
}
// 学号id查找贷款信息
export function selectLoanByStuid(stuid, page) {
  return request({
    url: "/selectLoanByStuid/" + stuid + "/page/" + page,
  });
}
// 姓名查找
export function selectStuName(name, page) {
  return request({
    url: "/select/" + name + "/page/" + page,
  });
}
// 毕业生姓名查找
export function selectGraduateName(name, page) {
  return request({
    url: "/selectGraduate/" + name + "/page/" + page,
  });
}
// 学号查找
export function selectStuid(stuid, page) {
  return request({
    url: "/selectid/" + stuid + "/page/" + page,
  });
}

// 学号查看违纪
export function selectPunish(stuid) {
  return request({
    url: "/selcetpunish/" + stuid,
  });
}

// 学号查看获奖
export function selectReward(stuid) {
  return request({
    url: "/selcetreward/" + stuid,
  });
}

// 查看班级人数
export function selectClassNuber() {
  return request({
    url: "/getclassnum",
  });
}

// 获取各省人数
export function selectProvince() {
  return request({
    url: "/getnative",
  });
}

// 获取奖励获取情况人数
export function selectRewardCount() {
  return request({
    url: "/getreward",
  });
}

// 获取处罚情况人数
export function selectPunishCount() {
  return request({
    url: "/getpunish",
  });
}

// 学籍改动情况
export function selectStatusChange() {
  return request({
    url: "/getchange",
  });
}

// 各班高数平均分
export function selectGradeAvg() {
  return request({
    url: "/getgradeavg",
  });
}

// 请求某学号是否已经存在
export function isExit(stuid) {
  return request({
    url: "/isexist/" + stuid,
  });
}

/**
 * stuStatus
 */
// 查找全部学生信息加学籍信息
export function selectallstudentstatus(page) {
  return request({
    url: "/select/allstudentstatus/" + page,
  });
}

// 提交修改学生信息
export function updateStuInfo(data) {
  return request({
    url: "/update",
    method: "post",
    data,
  });
}
// 提交修改学生信息
export function changeXueJiStatus(data) {
  return request({
    url: "/updateStatus",
    method: "post",
    data,
  });
}
// 提交修改
export function deleteStu(data) {
  return request({
    url: "/delete",
    method: "post",
    data,
  });
}
/**
 * admin页面
 */

// 查找admin
export function admin() {
  return request({
    url: "/admin",
  });
}
